/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author ivana
 */
@Entity
@Table(name = "estadoespera")
@NamedQueries({
    @NamedQuery(name = "Estadoespera.findAll", query = "SELECT e FROM Estadoespera e"),
    @NamedQuery(name = "Estadoespera.findByIdEstadoEspera", query = "SELECT e FROM Estadoespera e WHERE e.idEstadoEspera = :idEstadoEspera"),
    @NamedQuery(name = "Estadoespera.findByNombreEstadoEspera", query = "SELECT e FROM Estadoespera e WHERE e.nombreEstadoEspera = :nombreEstadoEspera")})
public class Estadoespera implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idEstadoEspera")
    private Integer idEstadoEspera;
    @Basic(optional = false)
    @Column(name = "nombreEstadoEspera")
    private String nombreEstadoEspera;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "estadoespera")
    private Collection<Transporte> transporteCollection;
    @OneToMany(mappedBy = "estadoespera")
    private Collection<Detallerecepcion> detallerecepcionCollection;

    public Estadoespera() {
    }

    public Estadoespera(Integer idEstadoEspera) {
        this.idEstadoEspera = idEstadoEspera;
    }

    public Estadoespera(Integer idEstadoEspera, String nombreEstadoEspera) {
        this.idEstadoEspera = idEstadoEspera;
        this.nombreEstadoEspera = nombreEstadoEspera;
    }

    public Integer getIdEstadoEspera() {
        return idEstadoEspera;
    }

    public void setIdEstadoEspera(Integer idEstadoEspera) {
        Integer oldIdEstadoEspera = this.idEstadoEspera;
        this.idEstadoEspera = idEstadoEspera;
        changeSupport.firePropertyChange("idEstadoEspera", oldIdEstadoEspera, idEstadoEspera);
    }

    public String getNombreEstadoEspera() {
        return nombreEstadoEspera;
    }

    public void setNombreEstadoEspera(String nombreEstadoEspera) {
        String oldNombreEstadoEspera = this.nombreEstadoEspera;
        this.nombreEstadoEspera = nombreEstadoEspera;
        changeSupport.firePropertyChange("nombreEstadoEspera", oldNombreEstadoEspera, nombreEstadoEspera);
    }

    public Collection<Transporte> getTransporteCollection() {
        return transporteCollection;
    }

    public void setTransporteCollection(Collection<Transporte> transporteCollection) {
        this.transporteCollection = transporteCollection;
    }

    public Collection<Detallerecepcion> getDetallerecepcionCollection() {
        return detallerecepcionCollection;
    }

    public void setDetallerecepcionCollection(Collection<Detallerecepcion> detallerecepcionCollection) {
        this.detallerecepcionCollection = detallerecepcionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEstadoEspera != null ? idEstadoEspera.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Estadoespera)) {
            return false;
        }
        Estadoespera other = (Estadoespera) object;
        if ((this.idEstadoEspera == null && other.idEstadoEspera != null) || (this.idEstadoEspera != null && !this.idEstadoEspera.equals(other.idEstadoEspera))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Estadoespera[idEstadoEspera=" + idEstadoEspera + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
